package com.addplus.townmall.server.api.mapper.town;

import com.addplus.townmall.server.api.model.town.ShopSpecificationName;
import com.addplus.townmall.server.api.model.town.expand.ShopSpecificationNameExpand;
import com.addplus.townmall.server.api.utils.BaseAddMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 * 商品规格名称 Mapper 接口
 * </p>
 *
 * @author zhangjiehang
 * @since 2018-08-27
 */
public interface ShopSpecificationNameMapper extends BaseAddMapper<ShopSpecificationName> {

    @Insert("<script>" +
            "insert into shop_specification_name(" +
            "name," +
            "platform_type_id," +
            "store_id," +
            "sort," +
            "type," +
            "is_deleted," +
            "gmt_create," +
            "gmt_modified" +
            ") values" +
            "<foreach collection='list' item='item'  separator=','>" +
            "(" +
            "#{item.name}," +
            "#{item.platformTypeId}," +
            "#{item.storeId}," +
            "#{item.sort}," +
            "#{item.type}," +
            "#{item.isDeleted}," +
            "now()," +
            "now()" +
            ")" +
            "</foreach>" +
            "</script>")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    void batchInsert(@Param("list") List<ShopSpecificationNameExpand> list);

}
